
#ifndef SIXDOFRESTRAINTWIDGET_H
#define SIXDOFRESTRAINTWIDGET_H

#include <BButton>
#include <BComboBox>
#include <BRealSpinBox>
#include <BFloatSpinBox>
#include <BFloatSlider>
#include <BDoubleSpinBox>
#include <BCheckBox>
#include <BLineEdit>
#include <BGroupBox>
#include <BSixdofRestraint>

using namespace BWE;

class SixdofRestraintPanel : public BWidget
{
	BOBJECT(SixdofRestraintPanel);
public:
	SixdofRestraintPanel(BWidget* parent = 0);
	~SixdofRestraintPanel();

protected:
	void slotAssetChanged(BObject* object, const BValue& value);

	void slotPivotAEditFinished(BObject* object, const BValue& value);
	void slotPivotBEditFinished(BObject* object, const BValue& value);

	void slotLinearLowerLimitEditFinished(BObject* object, const BValue& value);
	void slotLinearUpperLimitEditFinished(BObject* object, const BValue& value);

	void slotAngularLowerLimitEditFinished(BObject* object, const BValue& value);
	void slotAngularUpperLimitEditFinished(BObject* object, const BValue& value);

	void slotMotorEnabledBoxToggled(BObject* object, const BValue& value);
	void slotMotorTargetEditFinished(BObject* object, const BValue& value);
	void slotMotorVelocityEditFinished(BObject* object, const BValue& value);
	void slotMotorMaxForceEditFinished(BObject* object, const BValue& value);
	void slotMotorTargetSliding(BObject* object, const BValue& value);

	void slotGroupBoxTitleDoubleClicked(BObject* object, const BValue& value);

protected:
	virtual void updateEvent(const BEvent& event);

private:
	BSixdofRestraint*		_sixdofRestraint;

	BLineEdit*				_pivotAEdit;
	BLineEdit*				_pivotBEdit;

	BRealSpinBox*			_linearXMinSpinBox;
	BRealSpinBox*			_linearYMinSpinBox;
	BRealSpinBox*			_linearZMinSpinBox;

	BRealSpinBox*			_linearXMaxSpinBox;
	BRealSpinBox*			_linearYMaxSpinBox;
	BRealSpinBox*			_linearZMaxSpinBox;
	
	BRealSpinBox*			_linearXValueSpinBox;
	BRealSpinBox*			_linearYValueSpinBox;
	BRealSpinBox*			_linearZValueSpinBox;

	BRealSpinBox*			_angularXMinSpinBox;
	BRealSpinBox*			_angularYMinSpinBox;
	BRealSpinBox*			_angularZMinSpinBox;

	BRealSpinBox*			_angularXMaxSpinBox;
	BRealSpinBox*			_angularYMaxSpinBox;
	BRealSpinBox*			_angularZMaxSpinBox;

	BRealSpinBox*			_angularXValueSpinBox;
	BRealSpinBox*			_angularYValueSpinBox;
	BRealSpinBox*			_angularZValueSpinBox;

	//linear motor settings
	BCheckBox*				_linearMotorXCheckBox;
	BFloatSlider*			_linearMotorXTargetSlider;
	BFloatSpinBox*			_linearMotorXTargetSpinBox;
	BDoubleSpinBox*			_linearMotorXVelocitySpinBox;
	BDoubleSpinBox*			_linearMotorXMaxForceSpinBox;

	BCheckBox*				_linearMotorYCheckBox;
	BFloatSlider*			_linearMotorYTargetSlider;
	BFloatSpinBox*			_linearMotorYTargetSpinBox;
	BDoubleSpinBox*			_linearMotorYVelocitySpinBox;
	BDoubleSpinBox*			_linearMotorYMaxForceSpinBox;

	BCheckBox*				_linearMotorZCheckBox;
	BFloatSlider*			_linearMotorZTargetSlider;
	BFloatSpinBox*			_linearMotorZTargetSpinBox;
	BDoubleSpinBox*			_linearMotorZVelocitySpinBox;
	BDoubleSpinBox*			_linearMotorZMaxForceSpinBox;

	//angular motor settings
	BCheckBox*				_angularMotorXCheckBox;
	BFloatSlider*			_angularMotorXTargetSlider;
	BFloatSpinBox*			_angularMotorXTargetSpinBox;
	BDoubleSpinBox*			_angularMotorXVelocitySpinBox;
	BDoubleSpinBox*			_angularMotorXMaxForceSpinBox;

	BCheckBox*				_angularMotorYCheckBox;
	BFloatSlider*			_angularMotorYTargetSlider;
	BFloatSpinBox*			_angularMotorYTargetSpinBox;
	BDoubleSpinBox*			_angularMotorYVelocitySpinBox;
	BDoubleSpinBox*			_angularMotorYMaxForceSpinBox;

	BCheckBox*				_angularMotorZCheckBox;
	BFloatSlider*			_angularMotorZTargetSlider;
	BFloatSpinBox*			_angularMotorZTargetSpinBox;
	BDoubleSpinBox*			_angularMotorZVelocitySpinBox;
	BDoubleSpinBox*			_angularMotorZMaxForceSpinBox;

};

#endif
